<template>
  <view class="house">
    <life-empty v-if="!houseList.length" url="/pkg-house/add-house/add-house" tip="您还没有认证房屋,请点击"></life-empty>
    <view v-else class="house-list">
      <home-item></home-item>
      <home-item></home-item>
      <home-item></home-item>
      <life-button icon="../../static/icon/add.png" @click='go'>添加新房屋</life-button>
      <!-- <life-empty url="/pkg-house/add-house/add-house" tip="添加新房屋"></life-empty> -->
    </view>
  </view>
</template>

<script>
  import {
    getHouseLisrt
  } from '@/api/house.js'
  export default {
    data() {
      return {
        houseList: []
      }
    },
    onLoad() {
      this.getHouseLisrt()
    },
    methods: {
      go() {
        uni.navigateTo({
          url: '/pkg-house/add-house/add-house'
        })
      },
      async getHouseLisrt() {
        const res = await getHouseLisrt()
        console.log(res)
        this.houseList = res.data
      }
    }
  }
</script>

<style lang="scss" scoped>
  .house {
    height: 100%;
    background-color: #FAFAFA;
  }
</style>
